package com.xnyzc.lhy.mis.controller.cmsapi.config;


import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.cms.config.OaSysSchedulingStrategy;
import com.xnyzc.lhy.mis.entity.param.cms.config.OaSysSchedulingStrategyParam;
import com.xnyzc.lhy.mis.service.cms.config.IOaSysSchedulingStrategyService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


/**
 * <p>
 * 调度策略 前端控制器
 * </p>
 *
 * @author baoyaze
 * @since 2019-10-23
 */
@RestController
@RequestMapping("/cmsapi/schedulingStrategy")
public class OaSysSchedulingStrategyController
{
    @Autowired
    private IOaSysSchedulingStrategyService schedulingStrategyService;

    @ApiOperation(value = "查询调度策略", notes = "查询调度策略")
    @PostMapping(value = "getSchedulingStrategyList")
    public Rv getList(@ApiParam(name = "SchedulingStrategyParam", value = "调度策略查询类") @RequestBody OaSysSchedulingStrategyParam schedulingStrategyParam)
    {
        return schedulingStrategyService.getSchedulingStrategyList(schedulingStrategyParam);
    }

    @ApiOperation(value = "查询调度策略详细", notes = "查询调度策略详细")
    @GetMapping(value = "getSchedulingStrategyDetail")
    public Rv getInfo(@ApiParam(name = "schedulingStrategyId", value = "调度策略的ID") Long schedulingStrategyId)
    {
        return schedulingStrategyService.getSchedulingStrategyInfo(schedulingStrategyId);
    }

    /**
     * 添加调度策略
     *
     * @param schedulingStrategy:接收调度策略的实体类
     * @return
     */
    @ApiOperation(value = "添加调度策略", notes = "添加调度策略")
    @PostMapping(value = "/addSchedulingStrategy")
    public Rv addSchedulingStrategy(
        @ApiParam(name = "SchedulingStrategyParam", value = "调度策略实体类") @RequestBody OaSysSchedulingStrategy schedulingStrategy)
    {
        return schedulingStrategyService.addSchedulingStrategy(schedulingStrategy);
    }

    /**
     * 更新调度策略
     *
     * @param schedulingStrategy:接收调度策略的实体类
     * @return
     */
    @ApiOperation(value = "更新调度策略", notes = "更新调度策略")
    @PostMapping(value = "/updateSchedulingStrategy")
    public Rv updateSchedulingStrategy(
        @ApiParam(name = "SchedulingStrategyParam", value = "调度策略实体类") @RequestBody OaSysSchedulingStrategy schedulingStrategy)
    {
        return schedulingStrategyService.updateSchedulingStrategy(schedulingStrategy);
    }

    /**
     * 删除调度策略
     *
     * @param schedulingStrategy:接收调度策略的实体类
     * @return
     */
    @ApiOperation(value = "删除调度策略", notes = "删除调度策略")
    @PostMapping(value = "/deleteSchedulingStrategy")
    public Rv deleteSchedulingStrategy(
        @ApiParam(name = "SchedulingStrategy", value = "调度策略实体类") @RequestBody OaSysSchedulingStrategy schedulingStrategy)
    {
        return schedulingStrategyService.deleteSchedulingStrategy(schedulingStrategy);
    }

    @ApiOperation(value = "禁用调度策略", notes = "禁用调度策略")
    @PostMapping(value = "/disabledSchedulingStrategy")
    public Rv disabledSchedulingStrategy(
        @ApiParam(name = "SchedulingStrategy", value = "调度策略实体类") @RequestBody OaSysSchedulingStrategy schedulingStrategy)
    {
        return schedulingStrategyService.disabledSchedulingStrategy(schedulingStrategy);
    }

    @ApiOperation(value = "启用调度策略", notes = "启用调度策略")
    @PostMapping(value = "/enabledSchedulingStrategy")
    public Rv enabledSchedulingStrategy(
        @ApiParam(name = "SchedulingStrategy", value = "调度策略实体类") @RequestBody OaSysSchedulingStrategy schedulingStrategy)
    {
        return schedulingStrategyService.enabledSchedulingStrategy(schedulingStrategy);
    }
}
